package com.beep.erp.model.home;

import com.beep.erp.common.bean.BizGoodsListBean;
import com.beep.erp.common.bean.ClassifyBean;
import com.beep.erp.http.HttpRetrofit;
import com.beep.erp.http.RetryWhenNetworkException;

import rx.Observable;

/**
 * Created by Jolly on 2018/8/2.
 */

public class HomeModel implements HomeContract.Model {
    @Override
    public Observable<BizGoodsListBean> getBizGoods(String sign, String timeStamp, int pageSize, int pageNo, String classify, String searchKey) {
        return HttpRetrofit.getInstance().apiService.getBizGoods(sign, timeStamp, pageSize, pageNo, classify, searchKey).compose(HttpRetrofit.toSubscribe()).compose(HttpRetrofit.toTransformer()).retryWhen(new RetryWhenNetworkException());
    }

    @Override
    public Observable<ClassifyBean> getGoodsClassify(String sign, String timeStamp, String type) {
        return HttpRetrofit.getInstance().apiService.getGoodsClassify(sign, timeStamp, type).compose(HttpRetrofit.toSubscribe()).compose(HttpRetrofit.toTransformer()).retryWhen(new RetryWhenNetworkException());
    }

}
